<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@page import="java.util.*,com.sms.user.*,com.sms.DB.*"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
	+ request.getServerName() + ":" + request.getServerPort()
	+ path + "/";
%>

<%
	//清除内存
	response.setHeader("Pragma","No-cache"); 
	response.setHeader("Cache-Control","no-cache"); 
	response.setDateHeader("Expires", 0);
	String userno=(String)session.getAttribute("userno");
	List<Student> list=User.getStudentInfo(userno);
	Student student=list.get(0);
%>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>个人信息管理</title>

<script type="text/javascript" src="../easyui/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="../easyui/jquery.easyui.min.js"></script>
<link rel="stylesheet" type="text/css" href="../easyui/themes/icon.css" />
<link rel="stylesheet" type="text/css"
	href="../easyui/themes/default/easyui.css" />
<link href="../css/main.css" rel="stylesheet" type="text/css" />
<style type="text/css">
.modyfies {
	display: none;
}
</style>
</head>

<body>

	<div style="top:100px;left:150px;position:relative">
		<fieldset style="height:300px; width:350px">
			&nbsp;
			<legend>可修改信息</legend>
			<p class="tip">点击修改按钮，可直接编辑修改信息，修改后提交即可</p>
			<form id="stuinfomod" method="post">
				<input type="hidden" name="fromID" value="<%%>" />
				<input type="hidden" name="role" value="xuesheng" />
				<table cellpadding="0" cellspacing="0">
					<tr>
						<td><label for="name">姓名：：</label></td>
						<td style="text-align:left;"><input class="modify"
							class="aaa" name="name" id="name" value="<%=student.getSname()%>"
							style="min-width:200px;" /></td>
					</tr>
					<tr>
						<td><label for="grade">学号：</label></td>
						<td style="text-align:left;"><input class="modify"
						class="aaa" 	type="text" name="sno" value="<%=student.getSno()%>"
							style="min-width:200px;" /></td>
					</tr>
					<tr>
						<td><label for="header">类型：</label></td>
						<td style="text-align:left;"><input class="modify"
							type="text" value="<%=student.getType()%>" name="stu_type"
							id="type" style="min-width:200px;" /></td>
					</tr>
					<tr>
						<td><label for="deadline" style="min-width:200px;">专业：</label>
						</td>
						<td style="text-align:left;"><input class="modify"
							name="major" id="major" value="<%=student.getMajor()%>"
							style="min-width:200px;" type="text" /></td>

					</tr>
					<tr>
						<td><label for="header">指导老师：</label></td>
						<td class="modify" style="text-align:left;"><input
							class="aaa" name="tno" id="tno" value="<%=student.getTname()%>"
							style="min-width:200px;" /></td>
					</tr>
					<tr>
						<td><label>性别：</label></td>
						<td style="text-align:left;"><input type="hidden" id="sex"
							value="<%=student.getSex()%>" />
							<center>
								<input class="aaa" type="radio" name="sex" value="男" id="nan" />
								男 <input class="aaa" name="sex" type="radio" value="女" id="nv" />
								女
							</center></td>

					</tr>
					<tr>
						<td><label>密码：</label></td>
						<td style="text-align:left;"><input class="modify"
							class="aaa" type="password" value="<%=student.getPassword()%>"
							name="passkey" id="file" style="min-width:200px;" /></td>
						<td style="color:#F00;"><input type="button" id="modifyb"
							value="修改密码" />
						</td>
					</tr>
					<tr class="modifies" style="display:none;">
						<td><label>初始密码：</label></td>
						<td style="text-align:left;"><input type="password"
							name="oripsw" id="file" style="min-width:200px;" /></td>

					</tr>
					<tr class="modifies" style="display:none;">
						<td><label>新密码：</label></td>
						<td style="text-align:left;"><input type="password"
							name="newpsw" id="file" style="min-width:200px;" /></td>

					</tr>
					<tr>
						<td align="center"><input type="button" id="mod" value="修改"
							style="margin-top:10px;" /></td>
						<td align="center"><input type="submit" id="submit"
							value="提交" style="margin-top:10px;" /></td>
					</tr>
				</table>
			</form>
		</fieldset>
	</div>
	<script type="text/javascript">
		$(document).ready(
				function() {

					var sex = $("#sex").val();
					if (sex == "女") {
						$("#nv").attr('checked', "checked");
						//alert("hgfhdhj");
					} else {
						//alert("hgfhdhj");
						$("#nan").attr('checked', "checked");
					}

					$("#modifyb").click(function() {
						$(".modifies").show();
					});

					$(".modify").attr('readonly', "readonly");

					$("#mod").click(function() {
						$(".modify").removeAttr('readonly');
						$(".aaa").attr('readonly', "readonly");
					});

					/*var str="hjdfhuhuh";
					$("#submit").click(function(){
					$.ajax({	
					url:'personalinfo_manage/modifyinfo.jsp',                             
					dataType:'text', 
					data:str,
					success:function(msg){
						alert(msg);
								if (msg == 'ok') {
									alert('修改成功');
									//$('#dd').dialog('close');
								} else {
									alert('修改不成功，请重新修改');
								}
						}
					})
					})*/
					$('#stuinfomod').submit(
							function(event) {
								event.preventDefault();

								var str = "hjdfhuhuh";
								//alert(str);
								var formValue = $(this).serialize();
								$.post('personalinfo_manage/modifyinfo.jsp',
										formValue, function(data) {
											alert(data[0].text);
											

										}, 'json');
								/*
								$.ajax({
								url : 'personalinfo_manage/modifyinfo.jsp',
								dataType : 'text',
								data : formValue,
								success : function(msg) {
									alert(msg);
									if (msg == 'ok') {
										alert('修改成功');
										//$('#dd').dialog('close');
									} else {
										alert('修改不成功，请重新修改');
									}
								}
								});
								 */
							});
					/*
						$("#submit").click(function() {
						
						//alert("hellow");
							//提交表单   	$("#stuinfomod").serialize()
								
							$("#stuinfomod").form('submit', {
								url : 'personalinfo_manage/modifyinfo.jsp',
								onSubmit : function() {
									//进行表单验证   
									//如果返回false阻止提交   
								},
								success : function(msg) {
									alert(msg);
									if (msg == 'ok') {
										alert('修改成功');
										//$('#dd').dialog('close');
									} else {
										alert('修改不成功，请重新修改');
									}
								}
							});
							
					alert("hellow");
						})
					 */
				})
	</script>

</body>
</html>
